import * as constants from './constants';
import { fromJS } from 'immutable';
import { getAllTablesAxios
 } from '../../../../../api/dataSource/tableManage';

import { message } from 'antd';

const getAllTables = (tables) => ({
  type: constants.GET_ALL_TABLES,
  tables: fromJS(tables),
});

export const getAllTablesOperation = (dataType,params) => {
  return(dispatch) => {
    getAllTablesAxios(dataType,params).then((res) => {
      if(res){
        if(res.data.ok){
          const tables = res.data.data;
          console.log(tables)
          dispatch(getAllTables(tables));
        }
      }
    });
  }
};